<template>
  <div class="action">
    <page-content
      :contentTableConfig="contentTableConfig"
      pageName="Getnews"
      ref="pageContentRef"
      :actions="changeNews"
      @editBtnClick="handleeditClick"
      :selectOptions="selectOptions"
      :isCreate="isCreate"
      @newBtnClick="newBtnClick"
    >
      <template #status="scope">
        <el-button plain size="mini" type="success">
          <template v-if="scope.row.status === 0"> 不显示 </template>
          <template v-if="scope.row.status === 1"> 显示 </template>
        </el-button>
      </template>
      <template #showIndex="scope">
        <el-button plain size="mini" type="success">
          <template v-if="scope.row.showIndex === 0"> 不显示 </template>
          <template v-if="scope.row.showIndex === 1"> 显示 </template>
        </el-button>
      </template>
      <template #avatar_url="scope">
        <el-image
          style="width: 60px; height: 60px"
          :src="scope.row.image"
          :preview-src-list="[scope.row.image]"
        />
      </template>
    </page-content>
    <page-modal
      pageName="newuser/runcheck"
      :modalConfig="modalConfig"
      modalName="审核"
      :default-info="defaultInfo"
      ref="refPageModal"
    ></page-modal>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { onUnmounted, reactive, ref } from 'vue'
import { contentTableConfig } from './congif/content.config'
import PageContent from '@/components/page-content'
import usePageModal from '@/hooks/use-page-modal'
import { modalConfig } from './congif/modal.config'
import PageModal from '@/components/page-modal'
import cache from '@/utils/cache'
import router from '@/router'
export default defineComponent({
  components: {
    PageContent,
    PageModal
  },
  name: 'action',
  setup() {
    const [refPageModal, defaultInfo, handleNewClick, handleeditClick] =
      usePageModal()
    const selectOptions = reactive([
      {
        value: 0,
        label: '健身食谱'
      },
      {
        value: 1,
        label: '健身动作'
      },
      {
        value: 2,
        label: '健身信息'
      },
      {
        value: 3,
        label: '俱乐部信息'
      }
    ])
    // const isSelect = ref(true)
    const changeNews = ref(true)
    const isCreate = ref(true)
    onUnmounted(() => {
      cache.deleteCache('Selectvalue')
    })

    const newBtnClick = () => {
      console.log('新建')
      router.push({
        name: 'news'
      })
    }
    const Edshow = ref(true)

    return {
      Edshow,
      isCreate,
      newBtnClick,
      contentTableConfig,
      selectOptions,
      // isSelect,
      changeNews,
      refPageModal,
      defaultInfo,
      handleNewClick,
      handleeditClick,
      modalConfig
    }
  }
})
</script>

<style scoped></style>
